package com.jrx.anytxn.transaction.job.autoPayment.step;

import com.jrx.anytxn.transaction.constant.TransBizConstant;
import com.jrx.anytxn.transaction.entity.AmLoanAccountInfo;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.batch.MyBatisPagingItemReader;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 第一次批扣读
 *
 * @author : zhenghaopu
 * 2019/11/22
 */
public class AutoPaymentFirstInitStep1Reader extends MyBatisPagingItemReader<AmLoanAccountInfo> {


    public AutoPaymentFirstInitStep1Reader(Date businessDate, SqlSessionFactory sqlSessionFactory, Integer pagesize, List<String> productIdList){
        setSaveState(false);
        setPageSize(pagesize);
        setSqlSessionFactory(sqlSessionFactory);
        setQueryId("com.jrx.anytxn.transaction.mapper.ext.ExtAmLoanAccountInfoMapper.selectByNextPaymentDateAndAccountStatusForBatchDistinct");
        Map<String, Object> map = new HashMap<>();
        map.put("nextPaymentDate",businessDate);
        map.put("status",TransBizConstant.LOAN_STATUS_1);
        map.put("productIdList",productIdList);
        setParameterValues(map);
    }
}
